//
//  Anthill.cpp
//  AntSimulation
//


#include "Anthill.h"
#include "Creator.h"
#include <string>
#include <iostream>

Anthill::Anthill() {}
Anthill::~Anthill(void) {}

void Anthill::act() {
	
	//std::cout<<std::endl<<"anthill acting, food in anthill: "<<this->foodcount<<std::endl;
	//check, how much food is in the anthill, for every 10 foods, create
	//a new ant
	while(foodcount>=10)
	{
		//create a new ant
		Ant* newAnt = Creator::getInstance()->Create_Ant(this->anthillArea);
		
		//add the ant to area
		this->anthillArea->AddToListFront(newAnt);
		
		//reduce the foodamount in the hill
		this->foodcount-=10;
		std::cout<<std::endl<<"ant created"<<std::endl;									 
	}
	
}

void Anthill::set_anthillArea(Area* _area)//sets the Area, where the hill is located
{
	this->anthillArea=_area;
}


Area* Anthill::get_anthillArea(void)//returns the Area, where the anthill is located
{
	return this->anthillArea;
}

void Anthill::set_foodcount(unsigned int _foodcount)//for setting the amount of food of the hill
{
	this->foodcount=_foodcount;
}
	
	
unsigned int Anthill::get_foodcount(void)//for getting the foodamount of the hill
{
	return this->foodcount;
}